# $1=IDE_ROOT, IDE根目录路径

IDE_ROOT=$1
export PATH="$IDE_ROOT/host/cygwin/bin:$PATH"

# 删除第一个参数
shift 1
# 将剩余参数存储到数组
projects=("$@")

for prj in "${projects[@]}"; do
    OUT_PATH="$prj/out"
    if [ ! -d "$OUT_PATH" ]; then
        echo "cleanup project $prj has been finished ..."
        continue
    fi
    cd $OUT_PATH
    echo "run $IDE_ROOT/host/cygwin/bin/make clean_all"
    $IDE_ROOT/host/cygwin/bin/make clean_all
    cd ..
    $IDE_ROOT/host/cygwin/bin/rm -rf $OUT_PATH
    echo "cleanup project $prj has been finished ..."
done

echo "clean up finished ..."